# -*- coding: utf-8 -*-
##############################################################################
#
#    OpenERP, Open Source Management Solution
#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

import logging

# from openerp import SUPERUSER_ID
from openerp import tools
from openerp.modules.module import get_module_resource
from openerp.osv import fields, osv
from openerp.tools.translate import _
from Crypto.Util.number import size

_logger = logging.getLogger(__name__)

class hr_employee(osv.osv):

    _inherit = "hr.employee"
    
    _columns = {
        'fingerprint_code': fields.integer('Fingerprint Code'),
        'comp_email': fields.char('Company Email'),
        'dept_related': fields.char('Department Related'), # many2one
        'acc_level': fields.many2one('hr.access.level', 'Access Level'),
        'class_id': fields.many2one('hr.employee.class', 'Class'),
        'extitle_id': fields.many2one('hr.extitle', 'Ex Title'),
        'group_id': fields.many2one('hr.employs.group', 'Group Id'),
        'wfield_id': fields.many2one('hr.employee.work.field', 'Work Field'),
        'pension_id': fields.many2one('hr.employee.pension', 'Retirement '),
        'blood_type': fields.selection([('A','A'),('B', 'B'), ('AB', 'AB'), ('O', 'O')],'Blood Type'),
        'religion_id': fields.many2one('hr.recruit.religion', 'Religion '),
        'mobile_phone': fields.integer('Mobile Phone', size=32),
        'personal_email': fields.char('Personal Email'),
        'type_id': fields.selection([('KTP','KTP'),('Rek.Bank', 'Rekening Bank'), ('Passport', 'Passport'), ('SIM_A', 'SIM A'), ('SIM_B', 'SIM B'),('SIM_C', 'SIM C')],'Type Id', required=True),
        'type_id_no': fields.char('Type Id No.', size=20, required=True),
        'degree_id': fields.many2one('hr.recruitment.degree', 'Degree'), 
        'sector_id': fields.many2one('hr.employee.majority', 'Sector'),
        'major_id': fields.many2one('hr.recruit.department.detail', 'Majority'),
        'univ_id': fields.many2one('hr.recruit.university', 'University'), #jurusan
        'ptkp_id': fields.many2one('hr.ptkp', 'Tax Status','code',required=True), 
        'npwp': fields.char('NPWP',size=20),
        'ttl_child': fields.integer('Total Child',size=20),
        'npp': fields.integer('NPP'),
        'npkj': fields.integer('NPKJ'),
        'country_id': fields.many2one('res.country', 'Country'),
        'province_id': fields.many2one('hr.recruit.prov', 'Province'),
        'city_id': fields.many2one('hr.recruit.city', 'City'),
        'sub_district_id': fields.many2one('hr.sub.district', 'Sub District'),
        'address_by_ktp': fields.char('Address'),
        'zip_code': fields.char('Zip Code', size=8),
        'employ_family_ids': fields.one2many('hr.employee.family.structure','employ_family_id', 'Family Structure'),
        'employ_education_ids': fields.one2many('hr.employee.education.history','employ_education_id', 'Education History'),
        'employ_language_ids': fields.one2many('hr.employee.language','employ_language_id', 'Language'),
        'employ_career_ids': fields.one2many('hr.employee.career.history','employ_career_id', 'Career History'),
        'employ_referency_ids': fields.one2many('hr.employee.reference','employ_referency_id', 'Reference'),
        'work_entry_date': fields.date('Work Entry Date'),
        'contract_status': fields.boolean('Contract Status'),
        'contract_no': fields.char('Contract No.'),
        'work_expired_date': fields.date('Work Expired Date'),
        
    }
    
class hr_employee_pension(osv.osv):
    
    _name = "hr.employee.pension"
    
    _columns = {
        'employ_pension_id': fields.integer('Pension'),       
    }
    
class hr_employee_family_structure(osv.osv):
    
    _name = "hr.employee.family.structure"
    
    _columns = {
        'employ_family_id': fields.many2one('hr.employee', 'Family Structure', required=True, ondelete='cascade'),
        'structure_id': fields.selection([('Husband','Husband'),('Wife', 'Wife'), ('Child_1', 'Child 1'), ('Child_2', 'Child 2'),
                                           ('Child_3', 'Child 3'), ('Child_4', 'Child 4'), ('Child_5', 'Child 5'), ('Child_6', 'Child 6'),
                                           ('Child_7', 'Child 7'), ('Child_8', 'Child 8'), ('Child_9', 'Child 9'), ('Child_10', 'Child 10')],'Type Id', required=True),
        'name': fields.char('Name', required=True),   
        'gender': fields.selection([('M','Male'),('F', 'Female')],'Gender'),
        'city_id_birth': fields.many2one('hr.recruit.city', 'City of Birth'),
        'date_id_birth': fields.date('Date Of Birth'),
        'degree_id': fields.many2one('hr.recruitment.degree', 'Degree'), 
        'occupation': fields.char('Occupation'),     
    }
    
class hr_employee_education_history(osv.osv):
    
    _name = "hr.employee.education.history"
    
    _columns = {
        'employ_education_id': fields.many2one('hr.employee', 'Education History', required=True, ondelete='cascade'),
        'name': fields.char('School Name', size=128, required=True),
        'major_id': fields.many2one('hr.recruit.department.detail', 'Majority'),
        'entry_date': fields.date('Entry Date'), 
        'leave_date': fields.date('Leave Date'),  
        'address': fields.text('Address'),     
    }
    
class hr_employee_language(osv.osv):
    
    _name = "hr.employee.language"
    
    _columns = {
        'employ_language_id': fields.many2one('hr.employee', 'Language', required=True, ondelete='cascade'),
        'country_id': fields.many2one('res.country', 'Language'),
        'expertise': fields.selection([('Basic','Basic'),('Intermediate', 'Intermediate'),('Advance', 'Advance')],'Expertise Level', required=True),   
    }

class hr_employee_career_history(osv.osv):
    
    _name = "hr.employee.career.history"
    
    _columns = {
        'employ_career_id': fields.many2one('hr.employee', 'Career History', ondelete='cascade'),
        'name': fields.char('Company Name',required=True),
        'address': fields.text('Address'),     
        'entry_date': fields.date('Entry Date'), 
        'leave_date': fields.date('Leave Date'),
        'job_title': fields.char('Job Title'), 
        'salary': fields.float('Salary'), 
        'reason': fields.text('Leave Reason'),         
    }    
    
class hr_employee_reference(osv.osv):
    
    _name = "hr.employee.reference"
    
    _columns = {
        'employ_referency_id': fields.many2one('hr.employee', 'Reference', ondelete='cascade'),
        'name': fields.char('Name'),
        'job_title': fields.char('Job Title'),
        'department': fields.char('Department'), 
        'phone': fields.char('Telephone',size=25),        
    }    

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
